/*

目前本题部分答案错误，待修改


*/

#include <stdio.h>

struct date
{
	int year;
	int month;
	int day;
}d;

int isleep(int year);
int month(int year, int month);

int main(void)
{
	//接受形如2009/03/02的日期输入
	scanf_s("%i/%i/%i", &d.year, &d.month, &d.day);
	//printf("输入了%d/%d/%d\n", d.year, d.month, d.day);

	int dayall = 0;

	//从一月开始加到需求月份-1的大小
	for (int i = 1; i < d.month; i++) {
		//传入日期获取返回的day,然后日期累加
		dayall = dayall + month(d.year, i);
	}

	//加上最后的日期
	dayall += d.day;

	//输出是今年的第几天
	printf("%d", dayall);

	return 0;
}

//输入月份，返回该月份的天数
int month(int year, int month)
{
	int day = 0;

	const int m[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

	day = m[month-1];

	if (month == 2 && isleep(year)) {
		day = 29;
	}

	//printf("返回了一个day = %d\n", day);

	return day;
}

int isleep(int year)
{
	int a = 0;

	if (year % 400 == 0 && (year % 4 == 0 || year % 100 != 0)) {
		a = 1;
	}
	return a;
}